package de.breitbeil.jbooking.richclient.form.binding.comboboxrenderer;

import java.text.SimpleDateFormat;

import de.breitbeil.jbooking.domain.Booking;

public class BookingRenderer extends AbstractComboboxRenderer {

	private SimpleDateFormat sdf;

	public BookingRenderer(SimpleDateFormat sdf) {
		this.sdf = sdf;
	}
	
	public String getString(Object item) {
	    if(item == null) {
            return " ";
        }
        Booking booking = (Booking) item;
        String from = (booking.getFrom() == null)? "" : sdf.format(booking.getFrom());
        String to = (booking.getTo() == null)? "" : sdf.format(booking.getTo());
        return  from + "-" + to;
	}
}
